package com.hong.concurrent.chapter6;

/**
 * @Author csh
 * @Description 写的工和
 * @Date 2018/7/1 16:29
 */
public class ReaderWorker extends  Thread{
    /*数据*/
    private final ShareData data;

    public ReaderWorker(ShareData data) {
        this.data = data;
    }

    @Override
    public void run() {
        try {
            while (true){
                char[] readBuf = data.read();
                System.out.println(Thread.currentThread().getName()+" reads "+String.valueOf(readBuf));
            }
        }catch (InterruptedException e){
            e.printStackTrace();
        }

    }
}
